package com.seqb.common.dao;

import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author lilinshen
 * @title 代码生成mapper接口
 * @description 请填写相关描述
 * @date 2019/11/12
 */
public interface GeneratorMapper {

    @Select("select table_name TABLENAME, ENGINE, table_comment TABLECOMMENT, create_time CREATETIME from information_schema.tables"
            + " where table_schema = (select database()) order by CREATETIME desc")
    List<Map<String, Object>> list();

    @Select("select count(*) from information_schema.tables where table_schema = (select database())")
    int count(Map<String, Object> map);

    @Select("select table_name TABLENAME, ENGINE, table_comment TABLECOMMENT, create_time CREATETIME from information_schema.tables"
            + "	where table_schema = (select database()) and table_name = #{tableName}")
    Map<String, String> get(String tableName);

    @Select("select column_name COLUMNNAME, data_type DATATYPE, column_comment COLUMNCOMMENT, column_key COLUMNKEY, EXTRA, is_nullable ISNULLABLE from information_schema.columns"
            + " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
    List<Map<String, String>> listColumns(String tableName);
}
